# coding=utf-8
import traceback


class D2ItemQuality:
    ITEMQUALITY_CRACKED = 1
    ITEMQUALITY_NORMAL = 2
    ITEMQUALITY_SUPERIOR = 3
    ITEMQUALITY_MAGIC = 4
    ITEMQUALITY_SET = 5
    ITEMQUALITY_RARE = 6
    ITEMQUALITY_UNIQUE = 7
    ITEMQUALITY_CRAFTED = 8
    ITEMQUALITY_TEMPERE = 9


class D2C_ChatMessageTypes:
    CHAT_NONE = 0
    CHAT_PLAYERMESSAGE = 1
    CHAT_RECEIVEDWHISPER = 2
    CHAT_UNUSED = 3
    CHAT_MESSAGE = 4
    CHAT_EMOTE = 5
    CHAT_SENTWHISPER = 6
    CHAT_CLUESCROLL = 7


def on_user_commands(cmd_str):
    log_msg('on_user_commands, ptPlayer.nUnitType=%s' % cmd_str)
    try:
        pass
        # import D2Ext
        # import _struct

        # fmt = 'B4sII'
        # pack = _struct.pack(fmt, 0x04, 'aaaa', 0x01, 0x0e)
        # size = _struct.calcsize(fmt)
        # D2Ext.D2SendPacketToClient(ptNetClient, pack, size)
        # FakeName = u'迪卡凯恩'.encode('gbk')
        # FakeMsg = u'恭喜你获得22#抚慰！'.encode('gbk')
        # fnl = len(FakeName)
        # fml = len(FakeMsg)
        # fmt = 'BBBBIBB%ssB100s' % fnl
        #
        # log_msg(str(locals()))
        #
        # pack = _struct.pack(fmt, 0x26, D2C_ChatMessageTypes.CHAT_PLAYERMESSAGE, 0x02, 0x09, 0x00, 0, 0, FakeName, 0, FakeMsg)
        # size = _struct.calcsize(fmt)
        # D2Ext.D2SendPacketToClient(ptNetClient, pack, size)

        # D2Ext.D2SpawnItem(ptGame, ptPlayer, 0x20343272, 99, D2ItemQuality.ITEMQUALITY_NORMAL, 1)

    except Exception as e:
        log_msg(traceback.format_exc())
